package com.example.bes1100.base.multiple.ds.demo.controller;

import com.example.bes1100.base.multiple.ds.demo.mapper.datasource2.UserMapper2;
import com.example.bes1100.base.multiple.ds.demo.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/d2")
public class TestController2 {

    private static final Logger log = LoggerFactory.getLogger(TestController2.class);

    @Autowired
    @Qualifier(value = "userMapper2")
    private UserMapper2 userMapper;

    @GetMapping
    public String test() {
        return "SUCCESS";
    }

    @GetMapping(value = "/user/all")
    public List<User> selectAll() {
        return userMapper.selectUserList2();
    }

}
